import bus from './bus'

const baseUrl = process.env.VUE_APP_API_BASE_URL
/**
 * 基础模块接口定义
 */
const api = {
  //网络请求成功状态值
  HTTP_OK_STATUS: 100,
  Login: '/base/login/token',
  Logout: '/auth/logout',
  ForgePassword: '/auth/forge-password',
  Register: '/auth/register',
  twoStepCode: '/auth/2step-code',
  SendSms: '/account/sms',
  SendSmsErr: '/account/sms_err',
  // get my info
  UserInfo: '/user/info',
  common: {
    showState: [{ label: '禁用', value: 0 }, { label: '启用', value: 1 }],
    dictDataType: [{ label: '字符串', value: 1 }, { label: '数组', value: 2 }],
    ossType: [{ label: '本地服务器', value: 'LOCAL_OSS' }, { label: '阿里云', value: 'ALI_OSS' }],
    pushType: [{ label: '极光', value: 'PUSH_JG' }],
    displayState: [{ label: '显示', value: true }, { label: '隐藏', value: false }],
    authState: [{ label: '否', value: 0 }, { label: '是', value: 1 }],
    menuLayout: [{ label: 'PageView', value: 'PageView' }, { label: 'RouteView', value: 'RouteView' }]
  },
  config: {
    oss: 'base/config/oss',
    ossSave: 'base/config/ossSave',
    pushSave: 'base/config/pushSave',
    sms: 'base/config/sms',
    get: 'base/config/get',
    smsSave: 'base/config/smsSave'
  },
  baseApi: {
    page: 'base/api/page',
    add: 'base/api/add',
    update: 'base/api/update',
    remove: 'base/api/remove',
    all: 'base/api/all',
    batchRemove: 'base/api/batch/remove',
    batchUpdateOpen: 'base/api/batch/update/open',
    batchUpdateStatus: 'base/api/batch/update/status',
    setAuthState: 'base/api/setAuthState'
  },
  /**
   * 网关
   */
  gateway: {
    list: 'base/gateway/list'
  },
  menu: {
    add: 'base/menu/add',
    update: 'base/menu/update',
    list: 'base/menu/all',
    setState: 'base/menu/setState',
    remove: 'base/menu/remove'
  },
  payconfig: {
    page: 'base/payconfig/page',
    setPayStatus: 'base/payconfig/setPayStatus',
    setIsTest: 'base/payconfig/setIsTest',
    update: 'base/payconfig/update'
  },
  file: {
    upload: baseUrl + '/app/file/upload',
    remove: '/app/file/remove'
  },
  area: {
    getPro: 'base/area/getPro',
    getCity: 'base/area/getCity',
    getArea: 'base/area/getArea'
  },
  user: {
    page: 'base/user/page',
    add: 'base/user/add',
    remove: 'base/user/remove',
    setStatus: 'base/user/setStatus',
    update: 'base/user/update',
    setRole: 'base/user/setRole',
    password: 'base/user/update/password',
    userStatus: [{ label: '正常', value: 1 }, { label: '禁用', value: 0 }],
    userType: [{ label: '超级管理员', value: 'super' }, { label: '普通管理员', value: 'normal' }]
  },
  appuser: {
    page: 'app/user/page',
    add: 'app/user/add',
    remove: 'app/user/remove',
    setStatus: 'app/user/setStatus',
    update: 'app/user/update',
    password: 'app/user/resetPwd'
  },
  appaccount: {
    page: 'app/account/page',
    add: 'app/account/add',
    remove: 'app/account/remove',
    update: 'app/account/update',
    password: 'app/account/update/password'
  },
  company: {
    page: 'base/company/page',
    add: 'base/company/add',
    details: 'base/company/details',
    setAuditState: 'base/company/setAuditState',
    setRecommend: 'base/company/setRecommend',
    update: 'base/company/edit',
    remove: 'base/company/delete',
    authStatus: [{ label: '未认证', value: 0 }, { label: '审核中', value: 1 }, { label: '已认证', value: 2 }, { label: '审核失败', value: 3 }],
    auditState: [{ label: '通过', value: 2 }, { label: '不通过', value: 3 }]
  },
  shop: {
    page: 'base/shop/page',
    add: 'base/shop/add',
    details: 'base/shop/details',
    setAuditState: 'base/shop/setAuditState',
    setRecommend: 'base/shop/setRecommend',
    update: 'base/shop/edit',
    remove: 'base/shop/remove',
    shopStatus: [{ label: '已审核', value: 1 }, { label: '退回', value: 2 }],
    shopStatus2: [{ label: '未审核', value: 0 }, { label: '已审核', value: 1 }, { label: '审核失败', value: 2 }]
  },
  dict: {
    initDict: 'base/dict/initDict',
    list: 'base/dict/list',
    add: 'base/dict/add',
    update: 'base/dict/update',
    remove: 'base/dict/delete'
  },
  html: {
    list: 'base/html/list',
    add: 'base/html/save',
    update: 'base/html/update',
    remove: 'base/html/delete'
  },
  dictData: {
    page: 'base/dictdata/page',
    add: 'base/dictdata/add',
    setState: 'base/dictdata/setState',
    update: 'base/dictdata/update',
    setUser: 'base/dictdata/users/add',
    remove: 'base/dictdata/remove',
    dicStatus: [{ label: '启用', value: 1 }, { label: '禁用', value: 0 }]
  },
  slider: {
    page: 'base/slider/page',
    add: 'base/slider/add',
    setSendStatus: 'base/slider/setSendStatus',
    update: 'base/slider/update',
    remove: 'base/slider/remove',
    sliderType: [{ label: 'App端', value: 1 }, { label: 'PC首页', value: 2 }, { label: '店铺轮播图', value: 3 }],
    jumpType: [{ label: '富文本', value: 3 }, { label: '外部链接', value: 1 }, { label: '内部模块', value: 2 }]
  },
  role: {
    page: 'base/role/page',
    add: 'base/role/add',
    update: 'base/role/update',
    setUser: 'base/role/users/add',
    remove: 'base/role/remove'
  },
  link: {
    page: 'base/link/page',
    add: 'base/link/add',
    setSendStatus: 'base/link/setSendStatus',
    update: 'base/link/update',
    remove: 'base/link/delete'
  },
  authority: {
    user: 'base/authority/user/grant',
    role: 'base/authority/role/grant'
  },
  brand: {
    page: 'base/brand/page',
    setRecommend: 'base/brand/setRecommend',
    add: 'base/brand/add',
    update: 'base/brand/update',
    delete: 'base/brand/delete',
    get: 'base/brand/get'
  },
  product: {
    page: 'app/product/page',
    setOnLineState: 'app/product/setOnLineState',
    setRecommend: 'app/product/setRecommend',
    getSkuList: 'base/product/sku/list',
    remove: 'base/product/remove',
    get: 'app/product/get'
  },
  specs: {
    page: 'base/specs/page',
    add: 'base/specs/save',
    setState: 'base/specs/setState',
    update: 'base/specs/update',
    remove: 'base/specs/delete',
    specsType: [{ label: '文本', value: 2 }, { label: '颜色', value: 1 }]
  },
  //商品分类
  category: {
    first: 'base/product/category/first',
    add: 'base/product/category/add',
    update: 'base/product/category/edit',
    remove: 'base/product/category/remove',
    list: 'base/product/category/list',
    second: 'base/product/category/second'
  },
  //商品规格模板
  specscategory: {
    getSpecsCategory: 'base/specscategory/getSpecsCategory',
    add: 'base/specscategory/add',
    update: 'base/specscategory/update'
  }
}
const all = Object.assign({}, api, bus)
export default all
